import java.util.ArrayList;
import java.util.List;

class Student {

    private String name;

    private String className;

    private String studentId;

    private int totalScore;

    private List<ScoreRecord> scoreHistory;  // 新增：记录加分历史



    public Student(String name, String className, String studentId, int totalScore) {

        this.name = name;

        this.className = className;

        this.studentId = studentId;

        this.totalScore = totalScore;

        this.scoreHistory = new ArrayList<>();  // 初始化加分历史记录列表

    }



    // Getter方法

    public String getName() {

        return name;

    }



    public String getClassName() {

        return className;

    }



    public String getStudentId() {

        return studentId;

    }



    public int getTotalScore() {

        return totalScore;

    }



    public List<ScoreRecord> getScoreHistory() {

        return new ArrayList<>(scoreHistory);  // 返回历史记录的副本

    }



    // 加分方法

    public void addScore(int points, String reason) {

        if (points <= 0) {

            throw new IllegalArgumentException("加分分数必须为正数");

        }

        this.totalScore += points;

        // 记录加分历史

        scoreHistory.add(new ScoreRecord(points, reason, System.currentTimeMillis()));

        System.out.printf("学生 %s 加分 %d 分，原因：%s，当前总分：%d%n",

                this.name, points, reason, this.totalScore);

    }



    @Override

    public String toString() {

        return String.format("Student{name='%s', className='%s', studentId='%s', totalScore=%d}",

                name, className, studentId, totalScore);

    }

}